#!/usr/bin/env python3


def full_array(s, path):
    if (len(s) <= 0):
        print(path)
        return
    for i in range(len(s)):
        s[0], s[i] = s[i], s[0]
        path.append(s[0])
        full_array(s[1:], path)
        s[0], s[i] = s[i], s[0]
        del path[-1]


if __name__ == '__main__':
    s = ['a','b','c']
    full_array(s, [])
    full_array([1,2,3,4], [])
